package in.zapr.druid.druidry;

import com.fasterxml.jackson.annotation.JsonInclude;
import in.zapr.druid.druidry.aggregator.DruidAggregator;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;

@Getter
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ApproxHistogramAggregator extends DruidAggregator {
    private static final String APPROX_HISTOGRAM_AGGREGATOR_TYPE = "approxHistogramFold";
    private String name;
    private String fieldName;
    private int resolution = 50;
    private String lowerLimit = "-Infinity";
    private String upperLimit = "+Infinity";
    private int numBuckets = 7;

    @Builder
    private ApproxHistogramAggregator(@NonNull String name, @NonNull String fieldName, int resolution,
                                      String lowerLimit, String upperLimit, int numBuckets) {
        this.type = APPROX_HISTOGRAM_AGGREGATOR_TYPE;
        this.name = name;
        this.fieldName = fieldName;
        this.resolution = resolution;
        this.lowerLimit = lowerLimit;
        this.upperLimit = upperLimit;
        this.numBuckets = numBuckets;
    }
}
